package com.richinfo.util;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

/**
 * xml解析类
 * @author M
 *
 */
public class XmlUtil {
	
	private final static String DEFAULTENCODEING = "UTF-8";

	public static Element getDomBody(String message) throws DocumentException {
		return getDomBody(message, null);
	}

	public static Element getDomBody(String message, String encoding)
			throws DocumentException {
		if (encoding == null || encoding.trim().equals("")) {
			encoding = DEFAULTENCODEING;
		}
		Document doc = null;
		doc = DocumentHelper.parseText(message);
		Element body = doc.getRootElement();
		return body;
	}

}